package cn.wolfcode.trip.api.controller;

import cn.wolfcode.trip.base.domain.News;
import cn.wolfcode.trip.base.query.NewsCommendQuery;
import cn.wolfcode.trip.base.service.INewsCommendService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 日报推荐资源控制器
 */
@RestController
@RequestMapping("newsCommends")
public class NewsCommendController {
    @Autowired
    private INewsCommendService commendService;

    /**
     * 获取日报推荐的数据接口
     * 1.资源 /newsCommends
     * 2.请求方式 get
     * 3.请求参数 type
     * 4.返回结果 PageInfo
     */
    @GetMapping
    public PageInfo query(NewsCommendQuery qo){
        qo.setState(News.STATE_RELEASE);
        return commendService.queryForApp(qo);
    }
}
